# Importing Data
CHINA<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Plastic/Plastics.xlsx",sheet = "Sheet1", range = "a1:a70")

# Checking the Imported Data
View(CHINA)
# Creating Time Series Data
CHINA_ts <- ts(CHINA, start=c(2006), end=c(2018), frequency=1)
# Viewing and Checking the Created Time Series Data
CHINA_ts
sum(is.na(CHINA_ts))
library(forecast)
CHINA_ts <- tsclean(CHINA_ts)
CHINA_ts

# Identification: Plotting the Time Series Data
plot(CHINA_ts)

# Estimating the appropriate model
CHINA_ts_model <- auto.arima(CHINA_ts)
CHINA_ts_model

# Forecasting
options(max.print=1000000)
CHINA_ts_forecast <- forecast (CHINA_ts_model, level=c(95), h=22)
plot(CHINA_ts_forecast)
CHINA_ts_forecast             

# Exporting
write.table(CHINA_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Plastic/CHINA_TSA.csv", sep=",")


